package com.tianhui.consignortwofei.mvp.model;

import android.content.Context;

import com.fgs.common.CommonModel;
import com.fgs.common.api.CommonApiService;
import com.fgs.common.api.CommonConfig;
import com.fgs.common.progress.ObserverResponseListener;
import com.tianhui.consignortwofei.api.AccountApiService;
import com.tianhui.consignortwofei.api.OrderApiService;
import com.tianhui.consignortwofei.mvp.model.enty.PaymentApplyInfo;
import com.tianhui.consignortwofei.mvp.model.hetong.ShenPiTiJiaoOneBean;

import java.util.List;
import java.util.Map;

import io.reactivex.ObservableTransformer;
import okhttp3.MultipartBody;

/**
 * @author fgs
 * @date 2020/3/27
 **/
public class UserInfoModel<T> extends CommonModel implements IPictureModel<T> {
    /**
     * 用户信息
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void userInfoModel(Context context, boolean isDialog,
                              ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).userInfo(), observerListener, transformer, isDialog, true);
    }


    /**
     * 账户信息
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void capitalInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).capitalInfo(map), observerListener, transformer, isDialog, true);
    }
    /**
     * 修改密码
     *
     * @param context
     * @param map
     * @param isDialog
     * @param cancelable
     * @param transformer
     * @param observerListener
     */
    public void changePasswordModel(Context context, Map<String, String> map, boolean isDialog, boolean cancelable,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).changePassword(map), observerListener, transformer, isDialog, cancelable);
    }
    /**
     * 重置密码（忘记密码）
     *
     * @param context
     * @param map
     * @param isDialog
     * @param cancelable
     * @param transformer
     * @param observerListener
     */
    public void resetPasswordModel(Context context, Map<String, String> map, boolean isDialog, boolean cancelable,
                                   ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).resetPassword(map), observerListener, transformer, isDialog, cancelable);
    }

    /**
     * 上传头像
     *
     * @param context
     * @param map
     * @param isDialog
     * @param cancelable
     * @param transformer
     * @param observerListener
     */
    public void uploadHeadModel(Context context, Map<String, String> map, boolean isDialog, boolean cancelable,
                                ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).uploadHead(map), observerListener, transformer, isDialog, cancelable);
    }

    /**
     * 账户资金明细列表
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void accountDetailListModel(Context context, Map<String, String> map, boolean isDialog,
                                       ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).accountDetailList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 付款申请
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void paymentApplyModel(Context context, PaymentApplyInfo applyInfo, boolean isDialog,
                                  ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).paymentApply(applyInfo), observerListener, transformer, isDialog, true);
    }

    /**
     * 付款确认
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void paymentConfirmModel(Context context, Map<String, String> map, boolean isDialog,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).paymentConfirm(map), observerListener, transformer, isDialog, true);
    }

    @Override
    public void uploadPictureModel(Context context, List<MultipartBody.Part> parts, boolean isDialog, ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {
        subscribe(context, CommonConfig.getInstance().create(CommonApiService.class).uploadPicture(parts), observerListener, transformer, isDialog, true);
    }

    /**
     * 获取车辆总数、附近车辆总数
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void vehicleNumberModel(Context context, boolean isDialog,
                                   ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).vehicleNumber(), observerListener, transformer, isDialog, true);
    }

    /**
     * 获取货主群组信息
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void consignorGroupListModel(Context context, Map<String, String> map, boolean isDialog,
                                        ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).consignorGroupList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 根据货主Id得到信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void consignorInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                   ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).consignorInfo(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机车辆统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void driverCarStatisticsInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                             ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).driverCarStatisticsInfo(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 司机车辆统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void driverCarStatisticsDataModel(Context context, Map<String, String> map, boolean isDialog,
                                             ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).driverCarStatisticsData(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 单据统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void orderStatisticsInfoModel(Context context, Map<String, String> map, boolean isDialog,
                                         ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).orderStatisticsInfo(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 单据统计信息
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void orderStatisticsDataModel(Context context, Map<String, String> map, boolean isDialog,
                                         ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).orderStatisticsData(map), observerListener, transformer, isDialog, true);
    }





    /**
     * 修改司机手机号
     *
     * @param context
     * @param map
     * @param isDialog
     * @param cancelable
     * @param transformer
     * @param observerListener
     */
    public void changedriverPhone(Context context, Map<String, String> map, boolean isDialog, boolean cancelable,
                                    ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).changePassword(map), observerListener, transformer, isDialog, cancelable);
    }



    /**
     * 获取通话记录
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */

    public void getTongHua(Context context, Map<String, String> map, boolean isDialog,
                                         ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).getTongHua(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 获取通话记录
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */

    public void getLiuLan(Context context, Map<String, String> map, boolean isDialog,
                           ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).getLiuLan(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 二维码登录网页
     *
     * @param context
     * @param map
     * @param isDialog
     * @param transformer
     * @param observerListener
     */

    public void setCodeLogin(Context context, Map<String, String> map, boolean isDialog,
                          ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).setCodeLogin(map), observerListener, transformer, isDialog, true);
    }



    /**
     * 获取运费计算List
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getJiSuanList(Context context, Map<String, String> map, boolean isDialog,
                                        ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).freightList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 获取逾期
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getYuQiTipList(Context context, Map<String, String> map, boolean isDialog,
                              ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).getYuQiTipList(map), observerListener, transformer, isDialog, true);
    }

    /**
     * 获取找车单
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getZhaoCheInfo(Context context, Map<String, String> map, boolean isDialog,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).getZhaoCheInfo(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 审核人列表
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getShenHeList(Context context, Map<String, String> map, boolean isDialog,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).getShenHeList(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 审批提交
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void postShenHeInfo(Context context, ShenPiTiJiaoOneBean applyInfo, boolean isDialog,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).postShenHeInfo(applyInfo), observerListener, transformer, isDialog, true);
    }




    /**
     * 流程显示
     *
     * @param context
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getLiuChengList(Context context, Map<String, String> map, boolean isDialog,
                              ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(OrderApiService.class).getLiuChengList(map), observerListener, transformer, isDialog, true);
    }



    /**
     * 审批同意不同意提交
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void postShenHeIsTong(Context context, ShenPiTiJiaoOneBean applyInfo, boolean isDialog,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).postShenHeIsTong(applyInfo), observerListener, transformer, isDialog, true);
    }




    /**
     * 获取审批信息
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void getShenHeInfo(Context context, Map<String, String> map, boolean isDialog,
                               ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).getShenHeInfo(map), observerListener, transformer, isDialog, true);
    }


    /**
     * 获取审批信息
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void downloadContract(Context context, Map<String, String> map, boolean isDialog,
                              ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).downloadContract(map), observerListener, transformer, isDialog, true);
    }



    /**
     * 获取审批信息
     *
     * @param context
     * @param applyInfo
     * @param isDialog
     * @param transformer
     * @param observerListener
     */
    public void downloadPingZheng(Context context, Map<String, String> map, boolean isDialog,
                                 ObservableTransformer<T, T> transformer, ObserverResponseListener observerListener) {

        subscribe(context, CommonConfig.getInstance().create(AccountApiService.class).downloadPingZheng(map), observerListener, transformer, isDialog, true);
    }



}
